/*
 * Copyright (C) 2012-2013  Romain DUBOIS
 * 
 * This file is part of NeMoS - Network and Modular Software
 * 
 * NeMoS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * NeMoS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with NeMoS.  If not, see <http://www.gnu.org/licenses/>.
 */
package nemos.remote;

import java.lang.reflect.Method;

import org.osgi.framework.ServiceReference;

/**
 * RemoteCall : The remote call data object.
 * 
 * @author Romain DUBOIS
 */
public class RemoteCall {

    /** The calling framework UUID */
    private final String mFrameworkUuid;

    /** The called service reference */
    private ServiceReference<?> mReference;
    /** The called service */
    private Object mService;
    /** The called method */
    private Method mMethod;
    /** The call parameters */
    private Object[] mParameters;
    /** The call result */
    private Object mResult;

    /**
     * Constructor
     * 
     * @param pFrameworkUuid
     *            The calling framework UUID
     */
    public RemoteCall(final String pFrameworkUuid) {
        super();

        mFrameworkUuid = pFrameworkUuid;
    }

    /**
     * Get the calling framework UUID.
     * 
     * @return The calling framework UUID
     */
    public String getFrameworkUuid() {
        return mFrameworkUuid;
    }

    /**
     * Get the service reference.
     * 
     * @return The service reference
     */
    public ServiceReference<?> getReference() {
        return mReference;
    }

    /**
     * Modify the service reference.
     * 
     * @param pReference
     *            The service reference to set
     */
    public void setReference(final ServiceReference<?> pReference) {
        mReference = pReference;
    }

    /**
     * Get the service.
     * 
     * @return The service
     */
    public Object getService() {
        return mService;
    }

    /**
     * Change the service.
     * 
     * @param pService
     *            The service to set
     */
    public void setService(final Object pService) {
        mService = pService;
    }

    /**
     * Get the method.
     * 
     * @return The method
     */
    public Method getMethod() {
        return mMethod;
    }

    /**
     * Change the method.
     * 
     * @param pMethod
     *            The method to set
     */
    public void setMethod(final Method pMethod) {
        mMethod = pMethod;
    }

    /**
     * Get the parameters.
     * 
     * @return The parameters
     */
    public Object[] getParameters() {
        return mParameters;
    }

    /**
     * Change the parameters.
     * 
     * @param pParameters
     *            The parameters to set
     */
    public void setParameters(final Object[] pParameters) {
        mParameters = pParameters;
    }

    /**
     * Get the result.
     * 
     * @return The result
     */
    public Object getResult() {
        return mResult;
    }

    /**
     * Change the result.
     * 
     * @param pResult
     *            The result to set
     */
    public void setResult(final Object pResult) {
        mResult = pResult;
    }
}
